/**
 * Created by zheng on 2018/12/15.
 */
const { injectBabelPlugin } = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');
const path = require('path');
function resolve(dir) {
	return path.join(__dirname, dir)
}

module.exports = function override(config, env) {
	// do stuff with the webpack config...
	config = injectBabelPlugin(
		// ['import', { libraryName: 'antd', libraryDirectory: 'es', style: 'css' }],
		['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }], // change importing css to less
		config,
	);
	config = rewireLess.withLoaderOptions({
		modifyVars: { "@primary-color": "#1DA57A" },
		javascriptEnabled: true,
	})(config, env);
	config.resolve.alias = {
		...config.resolve.alias,
		'@': resolve('/src')
	}
	return config;
};